<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>

        //1、字符串.startsWith('字符'):判断某个字符串是否是以指定的字符开头

        let url = '/news/list';
       // url = 'goods/list';
        if(url.startsWith('/news')){
            console.log('yes');
        }else{
            console.log('no');
        }


        //2、字符串.endsWidth( 参数字符 )：判断某个字符串是否是以指定的字符结尾


        //3、字符串.repeat(n):将某个字符串重复n次
        let str = 'Ok'
        let str2 = '*'
        console.log(str2.repeat(8));
       console.log(str.repeat(3));

       //4、字符串.padStart( 目标长度，填充的字符 )：字符串头部补齐
       let str3 = 'this is my demo'
      console.log(str3.padStart(15,'this is')) ;


      //5、字符串.padEnd( 目标长度，填充的字符 )：字符串尾部补齐

    </script>
</head>
<body>
    
</body>
</html>